#pragma once

#include <maxplugin/scene_saver.h>
#include <maxplugin/mesh.h>

namespace Ogre
{
class DefaultHardwareBufferManager;
class RootEx;
class ModelPtr;
class NodeAnimationData;
class SkeletonPtr;
}

class ogre_scene_saver : public scene_saver
{
public:
	ogre_scene_saver(TimeValue time, bool export_selected);
	virtual ~ogre_scene_saver();

	virtual bool save(const char *path);

private:
	void write_meshes();
	void write_materials();
	void write_textures();
	void write_skeletons();

	Ogre::NodeAnimationData convert_animation(animation_ptr anm);
	Ogre::ModelPtr convert_model(model_ptr m);

	void convert_bones(Ogre::SkeletonPtr target, joint *source);

private:
	Ogre::DefaultHardwareBufferManager	*m_hbm;
	Ogre::RootEx						*m_root;
};